package com.tencreat.domain.mall.dto;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 获取unionId入参
 * @author zixin
 */
@Data
public class WxApiUnionIdDTO {

    @ApiModelProperty(value = "code", required = true)
    @NotBlank
    private String code;

    @ApiModelProperty(value = "客户端类型, 0|App,1|公众号,2|小程序",required = true)
    @NotNull
    private Integer clientType;

    @ApiModelProperty(hidden = true, name = "用户ID")
    private Long userId;

    public enum ClientType {

        /** app */
        APP(0),
        /** 公众号 */
        OFFICIAL(1),
        /** 小程序 */
        APPLET(2);

        @JsonValue
        @EnumValue
        private int value;

        ClientType(int value) {
            this.value = value;
        }

        public int getValue() {
            return value;
        }
    }

}
